# Female (Note that there are 2 NAs in this variable, i.e., two observations will be excluded from the main analysis)
tan$female <- NA
tan$female[tan$sex_q2_1 == "Female"] <- 1
tan$female[tan$sex_q2_1 == "Male"] <- 0

# Satisfaction with police
tan$police_satisfactory <- NA
tan$police_satisfactory[tan$robbed_police_q11_1 == "Not at all likely"] <- 0 
tan$police_satisfactory[tan$robbed_police_q11_1 == "Somewhat likely"] <- 1
tan$police_satisfactory[tan$robbed_police_q11_1 == "Very likely"] <- 2

tan$police_satisfactory <- tan$police_satisfactory/2

# Support for mob violence 
tan$support_mob_driver <- NA
tan$support_mob_driver[grepl(pattern = "beat the truck driver",
                             x = as.character(tan$truck_beat_q14_2),
                             ignore.case = TRUE)] <- 1
tan$support_mob_driver[!grepl(pattern = "beat the truck driver|know|refuse",
                              x = as.character(tan$truck_beat_q14_2),
                              ignore.case = TRUE)] <- 0
tan$support_mob_driver[is.na(tan$truck_beat_q14_2)] <- NA

# Community
tan$village <- tan$survey_villageid
